import UIKit

// When attributes=nil, the methods declared here uses the default behavior for each attribute described in <UIKit/NSAttributedString.h>. When stringDrawingContext=nil, it's equivalent of passing the default instance initialized with [[NSStringDrawingContext alloc] init].
@available(iOS 6.0, *)
extension QKC where AA :NSStringDrawingContext {
	// Minimum scale factor for drawWithRect:options:context: and boundingRectWithSize:options:context: methods. If this property is set, the extended string drawing methods will attempt to draw the attributed string in the given bounds by proportionally scaling the font(s) in the attributed string
    open func minimumScaleFactor_qk_s(_ minimumScaleFactor:  CGFloat) -> QKC<AA,YY,ZZ, CGFloat>{
		return link(next: minimumScaleFactor).then_QK { $0.value.minimumScaleFactor = minimumScaleFactor }
	}
    open func minimumScaleFactor_qk_g() -> QKC<AA,YY,ZZ, CGFloat>{
		 self +^ self.value.minimumScaleFactor
	}

	// actual scale factor used by the last drawing call where minimum scale factor was specified
    open func actualScaleFactor_qk_g() -> QKC<AA,YY,ZZ, CGFloat >{
		 self +^ self.value.actualScaleFactor
	}

	// bounds of the string drawn by the previous invocation of drawWithRect:options:context:
    open func totalBounds_qk_g() -> QKC<AA,YY,ZZ, CGRect >{
		 self +^ self.value.totalBounds
	}

}

extension QKC where AA :NSString {
    @available(iOS 7.0, *)
    open func size_qk_f(withAttributes attrs: [NSAttributedString.Key : Any]? = nil) -> QKC<AA,YY,ZZ,CGSize>{
		 self +^ self.value.size(withAttributes:attrs)
	}

    @available(iOS 7.0, *)
    open func draw_qk_f(at point: CGPoint, withAttributes attrs: [NSAttributedString.Key : Any]? = nil) -> QKC<AA,YY,ZZ, CGPoint>{
		 self +^ self.value.draw(at:point, withAttributes:attrs) +^ point
	}

    @available(iOS 7.0, *)
    open func draw_qk_f(in rect: CGRect, withAttributes attrs: [NSAttributedString.Key : Any]? = nil) -> QKC<AA,YY,ZZ, CGRect>{
		 self +^ self.value.draw(in:rect, withAttributes:attrs) +^ rect
	}

}

extension QKC where AA :NSAttributedString {
    @available(iOS 6.0, *)
    open func size_qk_f() -> QKC<AA,YY,ZZ,CGSize>{
		 self +^ self.value.size()
	}

    @available(iOS 6.0, *)
    open func draw_qk_f(at point: CGPoint) -> QKC<AA,YY,ZZ, CGPoint>{
		 self +^ self.value.draw(at:point) +^ point
	}

    @available(iOS 6.0, *)
    open func draw_qk_f(in rect: CGRect) -> QKC<AA,YY,ZZ, CGRect>{
		 self +^ self.value.draw(in:rect) +^ rect
	}

}

extension QKC where AA :NSString {
    @available(iOS 7.0, *)
    open func draw_qk_f(with rect: CGRect, options: NSStringDrawingOptions = [], attributes: [NSAttributedString.Key : Any]? = nil, context: NSStringDrawingContext?) -> QKC<AA,YY,ZZ, CGRect>{
		 self +^ self.value.draw(with:rect, options:options, attributes:attributes, context:context) +^ rect
	}

    @available(iOS 7.0, *)
    open func boundingRect_qk_f(with size: CGSize, options: NSStringDrawingOptions = [], attributes: [NSAttributedString.Key : Any]? = nil, context: NSStringDrawingContext?) -> QKC<AA,YY,ZZ,CGRect>{
		 self +^ self.value.boundingRect(with:size, options:options, attributes:attributes, context:context)
	}

}

extension QKC where AA :NSAttributedString {
    @available(iOS 6.0, *)
    open func draw_qk_f(with rect: CGRect, options: NSStringDrawingOptions = [], context: NSStringDrawingContext?) -> QKC<AA,YY,ZZ, CGRect>{
		 self +^ self.value.draw(with:rect, options:options, context:context) +^ rect
	}

    @available(iOS 6.0, *)
    open func boundingRect_qk_f(with size: CGSize, options: NSStringDrawingOptions = [], context: NSStringDrawingContext?) -> QKC<AA,YY,ZZ,CGRect>{
		 self +^ self.value.boundingRect(with:size, options:options, context:context)
	}

}

